<?php

/**
 * 会员上传
 */

namespace app\member\common;

class UploadCommon extends \app\member\common\MemberCommon {

    protected function index() {
        $return = array('status' => 1, 'info' => '上传成功', 'data' => []);
        $info = target('member/Member', 'service')->upload($this->userInfo['user_id'], 'jpg,png,bmp,jpeg', 1000, 1000, false);

        if ($info) {
            $info = reset($info);
            $return['data'] = $info;
        } else {
            $return['status'] = 0;
            $return['info'] = target('member/Member', 'service')->getError();
        }
        $this->json($return);
    }

}